package com.eduagent.xwqeduagent.app.student.ProfessionalCourseAssistant;

import com.eduagent.xwqeduagent.adviser.MyLoggerAdvisor;
import com.eduagent.xwqeduagent.app.agent.GenerateMindMap;
import com.eduagent.xwqeduagent.constant.prompt.TeaMulGenerateSystem;
import com.eduagent.xwqeduagent.rag.QueryRewriter;
import com.eduagent.xwqeduagent.rag.QueryTranslation;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class ProfessionalCourseAssistant {

    private final ChatClient chatClient;

    @Resource
    private QueryRewriter queryRewriter;

    @Resource
    private QueryTranslation queryTranslation;

    @Resource
    private ToolCallback[] allTools;

    @Resource
    private GenerateMindMap generateMindMap;

    @Resource
    private ToolCallbackProvider toolCallbackProvider;


    private final String schoolteacherPrompt = TeaMulGenerateSystem.TEACHER_PROMPT;

    /**
     * 初始化教师端资源生成和AI助手客户端
     */
    public ProfessionalCourseAssistant(ChatModel dashscopeChatModel) {

        chatClient = ChatClient.builder(dashscopeChatModel)
                .defaultSystem(schoolteacherPrompt)
                .defaultAdvisors(
                        //自定义日志Advisor，可以按需开启
                        new MyLoggerAdvisor()
                        //自定义 Re2推理增强 Advisor，可以按需开启
                        //new ReReadingAdvisor(),
                        //new SensitiveWordAdvisor()
                )
                .build();
    }




}
